package com.bw.kf.lib_base.base

import androidx.lifecycle.ViewModel
import com.bw.kf.lib_base.utlis.http.ApiService
import com.bw.kf.lib_base.utlis.http.RetrofitUtlis
import com.google.gson.Gson
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody


open class BaseViewModel : ViewModel() {
    val apiService = RetrofitUtlis.getRetrofit().create(ApiService::class.java)
    fun mapToJson(map: Map<String, Any>) =
        RequestBody.create("application/json;charset=utf-8".toMediaTypeOrNull(), Gson().toJson(map))
}